import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   redirect: '/home'
  // },
  // {
  //   path: '/',
  //   redirect: '/',
  //   component: () => import('../views/pages/Main'),
  //   children: [
  //     {
  //       path: '/',
  //       name: 'home',
  //       component: () => import('../views/pages/home/Home')
  //     },
  //     {
  //       path: '/video',
  //       name: 'video',
  //       component: () => import('../views/pages/videoMange/videoMange')
  //     },
  //     {
  //       path: '/user',
  //       name: 'user',
  //       component: () => import('../views/pages/userMange/userMange')
  //     },
  //     {
  //       path: '/page1',
  //       name: 'page1',
  //       component: () => import('../views/pages/other/pageOne')
  //     },
  //     {
  //       path: '/page2',
  //       name: 'page2',
  //       component: () => import('../views/pages/other/pageTwo')
  //     }
  //   ]
  // },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/pages/Login/Login.vue')
  }
]

// 解决新版本router多次点击出错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  routes,
  originalPush
})

export default router
